package com.example.demo.test123;


import com.alibaba.fastjson.JSONObject;
import com.example.demo.mapper.UsertableZMapper;
import com.example.demo.mode1.Usertable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;


@Controller
public class dengluController {


    @Resource
    private UsertableZMapper usertableZMapper;
    @RequestMapping(value = "/", method = {RequestMethod.POST, RequestMethod.GET})
    public String login() {
        return "index";
    }
    @RequestMapping("loginPage")
    public String volidate(String username, String password, ModelMap map) {
        System.out.println("你输入的用户名为：" + username);
        System.out.println("你输入的密码为：" + password);
        boolean selectusertable = false;
        try {
            selectusertable = usertableZMapper.selectusertable(username, password);

        } finally {
            if (selectusertable == true) {
                return "Homepage";
            } else {
                return "user";
            }
        }

    }
}
